package demo.screens
{
	import com.cheezeworld.screens.IScreenItem;
	import com.cheezeworld.screens.Root;
	import com.urbansquall.ginger.Animation;
	import com.urbansquall.ginger.AnimationPlayer;
	import com.urbansquall.ginger.tools.AnimationBuilder;
	
	import flash.display.MovieClip;

	public class LoadMovieClipDemo extends DemoScreen
	{
		[Embed(source="../../assets/SwfAssets.swf", symbol="NumberThing")]
		private var MC_Box:Class;
		public function LoadMovieClipDemo(a_parentScreen:IScreenItem=null)
		{
			super(a_parentScreen);
			
			screenLabel = "Creating a bitmap animation \nfrom a MovieClip";
					
			// Load the movieclip using the AnimationBuilder class
			m_box = new AnimationPlayer();
			var animation:Animation;
			
			var mc:MovieClip = new MC_Box();
			animation = AnimationBuilder.importDisplayObject( mc, 5, 120, -mc.width/2, -mc.height/2 );
			animation.isLooping = true;
			m_box.addAnimation( "numbers", animation);
			
			m_box.x = Root.WIDTH/2;
			m_box.y = Root.HEIGHT/2;
			addChild( m_box );
		}
		
		public override function update(a_timePassed:int):void
		{
			m_box.rotation += 5;
			m_box.update( a_timePassed );
		}
		
		private var m_box:AnimationPlayer;
	}
}